<template>
  <base-button v-bind="$attrs" @click="clickFn"><slot></slot></base-button>
</template>

<script setup>
import { debounce } from 'lodash';
// 引入 产品提供的 原始组件
const BaseButton = tyRoot.tyGetMixinResource('ty-ui/lib/ty-button/tysrc/ty-base-button.vue');
// 在原组件的基础上 扩展additional属性
const props = defineProps({
  additional: {
    type: String,
    default: ''
  }
});
const emit = defineEmits(['click']);
// 重写原组件的click事件
const clickFn = debounce(
  () => {
    emit('click', props.additional);
  },
  1000,
  {
    leading: false,
    trailing: true
  }
);
</script>

<style scoped></style>
